fix truncated event log message#41327
Conversation
|
Pinging @elastic/sec-windows-platform (Team:Security-Windows Platform) |
|
|
I'm not sure how can I do it on Windows, it seems to be Linux hint? |
matthewscherer
left a comment
There was a problem hiding this comment.
Did you add any tests for this case as well?
|
|
||
| var bufferPtr *byte | ||
| if renderBuf != nil { | ||
| if len(renderBuf) > 0 { |
| // this behavior is bad for EvtFormatMessageKeyword as then the API returns a list of null terminated | ||
| // strings in the buffer (it's fine for now as we don't use this parameter value). | ||
| return common.UTF16ToUTF8Bytes(renderBuf, out) | ||
| // bufferUsed indicates the size used internally to render the message. When called with nil buffer |
There was a problem hiding this comment.
At some point it might be nice to profile this code and see how many time we actually see an insufficient buffer size passed to EvtFormatMessage(). I guess it's hard to know which messages our customers are using the most and which ones usually overrun this buffer.
There was a problem hiding this comment.
Yes, that's why I opted to increase the scratch buffer significantly to avoid double rendering. The size of the scratch buffer is still insignificant as it's only one buffer per event channel. Anyway unused memory from the buffer will just get paged out at runtime.
No I didn't add any test for the truncation as with having the fallback of allocating memory from the pool this should always succeed.
* fix truncated event log * changelog * fix warning * fix golint * playing hide an catch with CI * size in bytes * review * code review * add comment, unify code path * refactor code (cherry picked from commit 99d11eb)
* fix truncated event log * changelog * fix warning * fix golint * playing hide an catch with CI * size in bytes * review * code review * add comment, unify code path * refactor code (cherry picked from commit 99d11eb)
* fix truncated event log * changelog * fix warning * fix golint * playing hide an catch with CI * size in bytes * review * code review * add comment, unify code path * refactor code (cherry picked from commit 99d11eb)
* fix truncated event log * changelog * fix warning * fix golint * playing hide an catch with CI * size in bytes * review * code review * add comment, unify code path * refactor code (cherry picked from commit 99d11eb) Co-authored-by: Leszek Kubik <39905449+intxgo@users.noreply.github.com>
* fix truncated event log * changelog * fix warning * fix golint * playing hide an catch with CI * size in bytes * review * code review * add comment, unify code path * refactor code (cherry picked from commit 99d11eb) Co-authored-by: Leszek Kubik <39905449+intxgo@users.noreply.github.com>
* fix truncated event log * changelog * fix warning * fix golint * playing hide an catch with CI * size in bytes * review * code review * add comment, unify code path * refactor code (cherry picked from commit 99d11eb) Co-authored-by: Leszek Kubik <39905449+intxgo@users.noreply.github.com>
Fixes
Proposed commit message
Fix windows event log ingest issues caused by event message truncation.
Checklist
CHANGELOG.next.asciidocorCHANGELOG-developer.next.asciidoc.Disruptive User Impact
Author's Checklist
How to test this PR locally
Related issues
Use cases
Screenshots
Logs